# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=oledump
pkgver=0.0.81
pkgrel=1
groups=('blackarch' 'blackarch-binary' 'blackarch-malware')
pkgdesc='Analyze OLE files (Compound File Binary Format). These files contain streams of data. This tool allows you to analyze these streams.'
arch=('any')
url='http://blog.didierstevens.com/programs/oledump-py/'
license=('custom:unknown')
depends=('python' 'python-lxml' 'python-yara-python-dex' 'python-olefile')
source=("https://didierstevens.com/files/software/${pkgname}_V${pkgver//./_}.zip")
sha512sums=('cacf9b45c7a8a0c2a1e17456d534d41ea885bad9aded09953f8e7aa7b15a670b5b45bba84d8e14120f2e92ac2055e45474d13bafb79a1caf1d108360f3a1e4c2')

prepare() {
  find . -type f -name '*.py' -exec sed -i 's|env python|env python|' {} +
}

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  rm "${pkgname}_V${pkgver//./_}.zip"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

